<?php

class Damages_Methods_Request_ResetPassword extends Damages_Methods_Request {

  /**
   *
   * @var int 
   */
  public $id;

  public function __construct($params) {
    $this->id = (int) $params->id;
    parent::__construct($params);
  }

  /**
   * 
   * @return \Damages_Methods_Response
   * @throws Damages_Exception_App
   */
  public function process() {
    if (!Damages_Auth::getInstance()->checkPermission(Damages_Auth::PERMISSION_ADMIN))
      throw new Damages_Exception_App(Damages_Codes::ACCESS_DENIED);
    Damages_Tasks::resetPassword($this->id,true);
    $response = new Damages_Methods_Response(true);
    return $response;
  }

}